import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Question22 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        in.nextLine();
        String s = in.nextLine();
        char[] arrs = s.toCharArray();

        int ret = n;

        for (int i = 2; i <= n; i++) {
            for (int j = 0; j <= n - i; j++) {
                for (int t = j; t < j + i; t++) {
                    if (t == j) {
                        ret++;
                    }
                    else if (arrs[t - 1] != arrs[t]) {
                        ret++;
                    }
                }
                
            }
        }

        System.out.println(ret);
    }
}